#include "logic.h"

Piece* createPiece(int xpos, int ypos, enum playerColor pcolor, enum pieceType ptype){
	printf("Creating a %s %s at (%d,%d)\n", playerID[pcolor], pieceID[ptype], xpos, ypos);
	Piece* newPiece = (Piece*) malloc(sizeof(Piece));
	newPiece->piece = ptype; 
	newPiece->color = pcolor; 
	newPiece->xpos = xpos; newPiece->ypos = ypos;
	return newPiece;
}

void resetBoard(Board* board){
	printf("%s\n", "Resetting board");
	if (board != NULL)
		free(board);
	board = malloc(sizeof(Board));
	int file;
	int firstRank = 0, secondRank = 1, seventhRank = 6, eightRank = 7; 

	// Second Rank
	for (file = 0; file < BOARD_MAX_SIZE; file++){
		board->current[firstRank][file] = createPiece(secondRank,file, WHITE, PAWN);
	} 
	// Seventh Rank
	for (file = 0; file < BOARD_MAX_SIZE; file++){
		board->current[seventhRank][file] = createPiece(seventhRank,file, BLACK, PAWN);
	} 
	// First Rank	
	// Eight Rank

}